﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Master/PopupDiv.master"
    AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="Jzy.Web.SiteAdmin.FreindLink.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 90px;
            text-align: right;
            height: 30px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="height: 5px; line-height: 5px;">
    </div>
    <asp:Panel ID="pnlMain" runat="server" Width="100%" Style="height: 129px;">
        <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;" align="center">
            <tr>
                <td class="style1">
                    图标：
                </td>
                <td>
                    <asp:FileUpload ID="fileImage" runat="server" />
                    <a id="lnkImage" runat="server" target="_blank">
                        <asp:Image ID="img" runat="server" Visible="false" Height="25px" ImageAlign="AbsMiddle" BorderWidth="0" /></a>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    名称：
                </td>
                <td>
                    <asp:TextBox ID="Name" runat="server" CssClass="txt" Width="230px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Display="None" ControlToValidate="Name"
                        runat="server" ErrorMessage="请输入名称"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    链接地址：
                </td>
                <td>
                    <asp:TextBox ID="Url" runat="server" CssClass="txt" Width="230px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="Url" Display="None" ErrorMessage="请输入链接地址"></asp:RequiredFieldValidator>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <div id="lblMessage" style="display: none; text-align: center; line-height: 129px;">
        正在提交数据，请稍候...</div>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
        ShowSummary="False" />

    <script type="text/javascript">

        var form = document.forms[0];

        function form_submit() {

            if (Page_IsValid)//判断验证控件是否全部通过验证
            {
                window.setTimeout(function() {
                    var btnSave = document.getElementById("<%=btnSave.ClientID %>");
                    document.getElementById("lblMessage").style.display = "";
                    document.getElementById("<%=pnlMain.ClientID %>").style.display = "none";
                    btnSave.onclick = function() {
                        alert("正在提交数据，请不要重复提交");
                        return false;
                    }
                }, 1);
            }
        }

        if (form.attachEvent) {
            form.attachEvent("onsubmit", form_submit);
        }
        else if (form.addEventListener) {
            form.addEventListener("submit", form_submit, false);
        }
        
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" />
</asp:Content>
